Skip to content

Add test for rounded-zero protocol fee#979

Closed
Killerjunior wants to merge 1 commit into
LabsCrypt:mainfrom
Killerjunior:pr-945
Closed

Add test for rounded-zero protocol fee#979
Killerjunior wants to merge 1 commit into
LabsCrypt:mainfrom
Killerjunior:pr-945

Conversation

@Killerjunior

Copy link
Copy Markdown
Contributor

Closes #794

Description
This PR adds a focused contract test covering the case where a non-zero protocol fee rate produces a rounded fee of zero for very small amounts.

What changed

  • Added a single sentence of documentation in lib.rs
    • clarifies that when fee calculation truncates to zero, no transfer or fee_collected event occurs and the original amount is returned unchanged
  • Added a new test in test.rs
    • test_no_fee_transfer_or_event_when_fee_rounds_to_zero
    • verifies a tiny stream amount with a non-zero fee rate does not transfer funds to treasury
    • ensures no fee_collected event is emitted

Why

  • strengthens protocol fee behavior guarantees
  • covers the edge case where fee rounding would otherwise imply an incorrect treasury transfer or event emission
  • prevents regressions for minimal stream amounts under the current fee calculation

Testing

  • contract test added in test.rs

Notes

  • This PR is intentionally scoped to the rounded-zero fee edge case only.
  • No frontend or unrelated backend files are included.

@ogazboiz

ogazboiz commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

closing as already covered, #978 (just merged) includes this exact rounded-zero-fee test and the same collect_fee doc line, so it's on main now. verified the test itself is correct (i ran it, it passes), good catch on that edge case, it just landed via #978. thanks!

@ogazboiz ogazboiz closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing] collect_fee fee-rounds-to-zero branch untested - positive fee rate but amount too small to charge

2 participants